package t20220304;

import java.util.Random;

/**
 * @Author: DengJia
 * @Date: 2022/3/4 21:39
 * @Description:
 */

public class UsingStringBuilder {
    public static void main(String[] args) {
        Random random = new Random(47);
        StringBuilder builder = new StringBuilder("{");
        for (int i = 0; i < 10; i++) {
            builder.append(random.nextInt(100));
            builder.append(", ");
        }
        builder.delete(builder.length() - 2, builder.length());
        builder.append("]");
        String substring = builder.substring(0, 2);
        System.out.println(builder);
        System.out.println(substring);
        StringBuilder reverse = builder.reverse();
        System.out.println(reverse);
        System.out.println(builder);
    }
}
